import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.function.Function;

public class Sta {
    public static void main(String[] args){
        //创建集合，添加元素
        ArrayList<String> list=new ArrayList<>();
        Collections.addAll(list,"1","2","3","4","5","6");
        //常规方式
        ArrayList<Integer> list1=new ArrayList<>();
        for (String s : list) {
            int i=Integer.parseInt(s);
            list1.add(i);
        }
    //stream流
        list.stream().map(new Function<String, Integer>() {
            @Override
            public Integer apply(String s) {
                int i=Integer.parseInt(s);
                return i;
            }
        });
        //方法引用
        list.stream()
                .map(Integer::parseInt).forEach(s-> System.out.println(s));



    }
}
